package com.example.administrator.myapplication.formdetail;

import com.example.administrator.myapplication.data.Task;
import com.example.administrator.myapplication.data.source.TaskRepository;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * Created by Administrator on 2017/11/27.
 */

public class FormDetailPresenter implements FormDetailContract.Presenter{

    private TaskRepository mTaskRepository;
    private FormDetailContract.View mFormDetailView;


    public FormDetailPresenter (TaskRepository taskRepository, FormDetailContract.View view){

        mTaskRepository = taskRepository;
        mFormDetailView = view;
    }



    @Override
    public void start() {

    }

    @Override
    public void update(Task task) {
        mTaskRepository.updateTask(task);
    }

    @Override
    public void save(Task task) {
        mTaskRepository.saveTask(task);
    }

    @Override
    public String formatDate(long timeMillions) {
        Date date = new Date(timeMillions);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日", Locale.CHINESE);
        return sdf.format(date);
    }
}
